//
//  HLSettingAccountViewController.m
//  YueYue
//
//  Created by hulu001 on 2023/5/19.
//

#import "HLSettingAccountViewController.h"
#import "HLMineCell.h"

#import "HLSettingPasswordViewController.h"
#import "HLSettingLogoutConfirmViewController.h"

@interface HLSettingAccountViewController ()

@end

@implementation HLSettingAccountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = HLBackgroundColor;
}

- (void)setupNavigationItems
{
    [super setupNavigationItems];
    self.title = @"账号与安全";
}

- (void)initTableView
{
    [super initTableView];
    
    [self.datasources addObjectsFromArray:[HLMineCellModel cellWithSettingAccount]];
    
    self.tableView.backgroundColor = HLBackgroundColor;
    [self.tableView registerClass:[HLMineCell class] forCellReuseIdentifier:[HLMineCell identifyCell]];
    
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleDarkContent;
}

- (UIImage *)qmui_navigationBarBackgroundImage
{
    return [UIImage qmui_imageWithColor:HLBackgroundColor];
}

- (nullable UIColor *)qmui_navigationBarTintColor
{
    return UIColorBlack;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.datasources.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *sections = self.datasources[section];
    return sections.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    HLMineCell *cell = [tableView dequeueReusableCellWithIdentifier:[HLMineCell identifyCell]];
    cell.model = self.datasources[indexPath.section][indexPath.row];
    return cell;
}


- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = HLBackgroundColor;
    return footerView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 12;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    HLMineCellModel *model = self.datasources[indexPath.section][indexPath.row];
    
    switch (model.cellSpot) {
        case HLMineCellSpotSettingAccountPassword:
        {
            HLSettingPasswordViewController *settingPasswordVC = [[HLSettingPasswordViewController alloc] init];
            [self.navigationController pushViewController:settingPasswordVC animated:YES];
        }break;
        case HLMineCellSpotSettingAccountLogout:
        {
            HLSettingLogoutConfirmViewController *logoutConfirmVC = [[HLSettingLogoutConfirmViewController alloc] init];
            [self.navigationController pushViewController:logoutConfirmVC animated:YES];
        }break;
        case HLMineCellSpotSettingAccountWechat:
        {
            if ([model.detail isEqualToString:@"已绑定"]){
                return;
            }
        }break;
        
            
        default:
            break;
    }
    

    
}



@end
